Ext.apply(Ext.form.VTypes, {
	filetypeRange : function(val, field) {
		try {
			var txtvalue = field.getValue();
			var index = txtvalue.lastIndexOf('.');
			var str = txtvalue.substring(index + 1, txtvalue.length);
			var vals = ['xls','xlsx'];
			var flag = false;
			if(vals.indexOf(str.toLowerCase())>=0){
				flag = true;
			}else{
				flag = false;
			}
			return flag;
		} catch (e) {
			return false;
		}
	},
	filetypeRangeText:"只能上传Excel(xls,xlsx)类型的文件"
});
ImportUserWindow = function(obj){
	/**
	 *加载数据信息 
	 **/
	var loadInfo = function(){
		
	};
	/**
	 *提交表单数据信息 
	 **/
	var submit = function(){
		if(form.getForm().isValid()){
			var data = form.getForm().getValues();
		    var win = form.ownerCt;
		    win.fireEvent('submit',win,form,data);
		}else{
			SX.msg('系统提示','请填写合适的数据!',Ext.MessageBox.WARNING);
		}
	};
	/**
	 *上传附件数据信息 
	 **/
	
	var form = new Ext.form.FormPanel(
		{
			fileUpload: true,
			frame:true,
			enableKeyEvents: true,
			defaults:{anchor:'90%'},
			autoHeight: true,
			items:[
				{
					xtype: 'fileuploadfield',
					vtype:'filetypeRange',
					allowBlank:false,
					blankText:'请选择要导入的文件',
		            emptyText: '选择Excel文件',
		            fieldLabel: '导入模版文件',
		            name: 'userinfoexcel',
		            buttonText: '',
		            buttonCfg: {iconCls: 'excel-icon'}
				}
			]
		}
	);
	var config = {
		load:loadInfo,
		buttons:[
			{
				text:'确定',
				iconCls:'confirm',
				handler:submit,
				scope:this
			},
			{
				text:'取消',
				iconCls:'cancel',
				handler:function(){this.close()},
				scope:this
			}],
		items:[form],
		layout:'fit',
		constrain : true, 
		constrainHeader : true, 
		modal:true,
		iconCls:'excel',
		title:obj.title,
		width:400,
		autoHeight:true 	
	};
	ImportUserWindow.superclass.constructor.call(this,config);
}
Ext.extend(ImportUserWindow,Ext.Window);